package com.project.bean;

import javax.validation.constraints.*;
import java.time.LocalDate;

/**
 * 员工实体类
 */
public class EmployeeBean {
    private Integer id;
    //采用正则表达式进行校验，regexp定义校验的正则表达式
    //message表示校验失败后的错误提示
    @NotBlank(message = "姓名必须填写")//判断空字符串
    @Pattern(regexp = "[a-zA-Z\\u4e00-\\u9fa5]{2,}",
            message = "姓名必须为两位以上的汉字或字母")
    private String name;
    @NotNull(message = "生日格式为XXXX-XX-XX") //非空校验
    private LocalDate birthday;
    @NotNull(message = "工资必须为数字")
    @Max(value = 20000,message = "人傻钱多的老板") //最大值校验
    @Min(value = 2000,message = "这么低的工资，让不让人活了")//最小值校验
    private Integer money;
    @Pattern(regexp = "\\w{3,}@\\w{2}[.](com|cn|net)",message = "邮件格式为XX@XX.com") //邮箱校验
    @NotBlank(message = "邮箱必须填写")
    private String email;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}
